package com.gupt.weekly.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gupt.weekly.dao.ReportMapper;
import com.gupt.weekly.domain.Report;
import com.gupt.weekly.service.ReportService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author linzizun
 * @version 1.0
 * @date 2021/03/27 11:14
 */
@Service
public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> implements ReportService {
    @Override
    public int insert(Report report) {
        return baseMapper.insert(report);
    }

    @Override
    public Report selectById(String id) {
        return baseMapper.selectById(id);
    }

    @Override
    public List<Report> selectList(Report report) {
        QueryWrapper<Report> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", report.getUser_id())
                .or().eq("plan_id", report.getPlan_id());
        return baseMapper.selectList(queryWrapper);
    }
}
